/**
 *
 * Copyright © 2010 杭州邦盛金融信息技术有限公司 版权所有
 *
 */

package com.alvin.core;

import java.text.NumberFormat;

/**
 * NumberFormat测试类
 * 时间:2015年9月9日 下午4:47:37 <br/>
 * @author   alvin
 * @version
 */
public class NumberFormatTest {
	public static void main(String[] args) {
		Double num = 2342323433.231233234;
		System.out.println(NumberFormat.getInstance().format(num));
		System.out.println(NumberFormat.getNumberInstance().format(num));
		System.out.println(NumberFormat.getCurrencyInstance().format(num));
		System.out.println(NumberFormat.getPercentInstance().format(num));
		
		/**
		 * 测试结果
		 *  12,234,233.231
			12,234,233.231
			￥12,234,233.23
			1,223,423,323%

		 */
		
		NumberFormat nf = NumberFormat.getInstance();
		nf.setGroupingUsed(false);
		nf.setMaximumFractionDigits(2);
		nf.setMinimumFractionDigits(1);
		nf.setMaximumIntegerDigits(5);
		nf.setMinimumIntegerDigits(4);
		System.out.println(nf.format(num));     //23433.23
		
		
	}
}

